﻿using Ecommerce.API.Application.Command.RoleCommand;
using MediatR;
using Ecommerce.Domain.User;
using Ecommerce.Services.User;

namespace Ecommerce.API.Application.CommandHandlers.RoleHandler
{
    public class AccountUpdateCommandHandler :IRequestHandler<AccountUpdateCommand, int>
    {
        private readonly IUseInfoServices services;

        public AccountUpdateCommandHandler(IUseInfoServices services)
        {
            this.services = services;
        }
       
        public Task<int> Handle(AccountUpdateCommand request, CancellationToken cancellationToken)
        {
            return services.UpdateAccount(new Account() { Tid = request.Tid, Rid = request.Rid, UseId = request.UseId, UseSex = request.UseSex, UserName = request.UserName, Address = request.Address });
        }
    }
}